QTextCodec: avoid read-past-buffer in codecForName()
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Wed, 29 Jul 2026 08:26:16 +0000 (11:26 +0300)
committerDmitry Shachnev <mitya57@debian.org>
Wed, 29 Jul 2026 08:26:16 +0000 (11:26 +0300)
commitc8314f6b50b262823753f591516455682828363e
treec8fc52a77a43483b932b00e54dd558f3ff21f165
parente0cac7987003574122aaff0d3b456fba1d370d27
QTextCodec: avoid read-past-buffer in codecForName()

Origin: upstream, https://code.qt.io/cgit/qt/qt5compat.git/commit/?id=894079b4932dc878
Last-Update: 2026-07-26

The old code passed a QByteArray to a function taking const char*,
invoking QByteArray::operator const char*() implicitly.

The callee expects the argument to be NUL-terminated, but if the
QByteArray was created fromRawData(), that is not guaranteed.

In newer Qt versions we have nullTerminated(), but this needs to be
picked further back, so use a std::string to do the null-termination.

Gbp-Pq: Name CVE-2026-9499.diff
src/corelib/codecs/qtextcodec.cpp